cmake_minimum_required(VERSION 3.20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(test VERSION 0.1.0 LANGUAGES C CXX)

# 设置动态库输出目录
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib")

# 添加猫和狗的动态库
add_library(cat SHARED src/Cat.cpp)
add_library(dog SHARED src/Dog.cpp)

# 设置库的依赖包含目录
target_include_directories(cat PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(dog PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

# 添加主程序
add_executable(lcmtrader src/main.cpp src/AnimalFactory.cpp)

# 设置主程序的依赖包含目录
target_include_directories(lcmtrader PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

# 链接猫和狗的动态库
target_link_libraries(lcmtrader cat dog -ldl)